namespace RxjhServer
{
	public class duibi
	{
		public static byte[] GetBytes(int value)
		{
			return new byte[4]
			{
				(byte)(value & 0xFF),
				(byte)((value >> 8) & 0xFF),
				(byte)((value >> 16) & 0xFF),
				(byte)((value >> 24) & 0xFF)
			};
		}

		public static byte[] GetBytes(long value)
		{
			return new byte[8]
			{
				(byte)(value & 0xFF),
				(byte)((value >> 8) & 0xFF),
				(byte)((value >> 16) & 0xFF),
				(byte)((value >> 24) & 0xFF),
				(byte)((value >> 32) & 0xFF),
				(byte)((value >> 40) & 0xFF),
				(byte)((value >> 48) & 0xFF),
				(byte)((value >> 56) & 0xFF)
			};
		}

		public static int ToInt32(byte[] src, int offset)
		{
			return (src[offset] & 0xFF) | ((src[offset + 1] & 0xFF) << 8) | ((src[offset + 2] & 0xFF) << 16) | ((src[offset + 3] & 0xFF) << 24);
		}

		public static short ToInt16(byte[] src, int offset)
		{
			return (short)(src[offset] | (src[offset + 1] << 8));
		}

		public unsafe static bool IsEquals(string str1, string str2)
		{
			if (str1.Length != str2.Length)
			{
				return false;
			}
			bool result = true;
			int num = (str1.Length % 4 != 0) ? (4 - str1.Length % 4) : 0;
			int num2 = (str2.Length % 4 != 0) ? (4 - str1.Length % 4) : 0;
			int num3 = (num > num2) ? num : num2;
			int i;
			for (i = 0; i < num3; i++)
			{
				if (i < num)
				{
					str1 += " ";
				}
				if (i < num2)
				{
					str2 += " ";
				}
			}
			fixed (char* ptr = str1)
			{
				fixed (char* ptr3 = str2)
				{
					char* ptr2 = ptr;
					char* ptr4 = ptr3;
					while (i < str1.Length)
					{
						if (*(long*)ptr2 != *(long*)ptr4)
						{
							result = false;
							break;
						}
						i += 4;
						ptr2 += 4;
						ptr4 += 4;
					}
				}
			}
			return result;
		}
	}
}
